package com.upay.android.controller.activity;


import android.os.Bundle;

import com.upay.android.R;
import com.upay.android.controller.fragment.FixedPaymentFragment;
import com.upay.android.controller.fragment.FixedPaymentFragment.OnFixedPaymentSelectedListener;
import com.upay.android.controller.fragment.TransactionCalculatorFragment;
import com.upay.android.controller.policy.FixedPaymentResultMappingPolicy;
import com.upay.android.domain.group.GroupAccount;
import com.upay.android.domain.payment.FixedPaymentDetail;


public class FixedPaymentActivity<T extends FixedPaymentDetail> extends FragmentActivity implements OnFixedPaymentSelectedListener {
	
	/* ---- Constants ---- */
	
	/* ---- Instance Variables ---- */
	

	/* ---- Constructors ---- */
	
	/* ---- Business Methods ---- */

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Bundle extras = getIntent().getExtras();
        GroupAccount groupAccount = (GroupAccount)extras.get(GroupAccount.NAME);
        FixedPaymentFragment fragment = new FixedPaymentFragment();
        fragment.setGroupAccount(groupAccount);
        addFragment(R.id.fragmentContainer, fragment);
    }

	@Override
	public void onPaymentSelected(FixedPaymentResultMappingPolicy policy) {
		TransactionCalculatorFragment<FixedPaymentResultMappingPolicy> fragment = new TransactionCalculatorFragment<FixedPaymentResultMappingPolicy>();
		fragment.setResultMappingPolicy(policy);
		this.replaceFragment(R.id.fragmentContainer, fragment);	
	}
	

}
